{% extends "base.html" %}

{% block title %}Blog{% endblock %}
{% block content%}
    {% for post in post_list %}
        <div id="post">
            <div id="post-title">
            <a href="/blog/view?post_id={{post.id}}">{{post.title}}</a>
            <p class="sub-title"> {{post.created_time}} {{post.view}} views</p>
            </div>
           
            <div id="post-content">
            {{post.content|safe|linebreaks}}
            {%if user.is_staff%}
            <form action="/blog/del" method="post">
            {% csrf_token %}
            	<input type="hidden" value="{{post.id}}" name="post_id" />
                <input type="submit" value="delete" class="del-button" />
            </form>
            {%endif%}
            </div>
           
        </div>
    {%endfor%}
    {%if user.is_staff%}
    <a href="blog/add"><span class="new-entry-button">New Entry</span></a>
    {%endif%}
{% endblock %}
{%block sidebar%}
{%endblock%}
